package org.ko.core.logic.auth.impl;


import org.ko.core.dao.auth.RoleDao;
import org.ko.core.dao.support.Updater;
import org.ko.core.domain.auth.Role;
import org.ko.core.logic.auth.RoleSvc;
import org.ko.core.websupport.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * 系统角色管理Svc接口实现
 * @author BQC
 * @version 2014-09-14 15:24:26
 */
@Service
@Transactional
public class RoleSvcImpl implements RoleSvc {

	@Autowired
	private RoleDao dao;

	@Override
	public Role addDo(Role bean) {
		dao.save(bean);

		return bean;
	}

	/**
	 * 批量删除指定id实例
	 */
	public void delete(Long[] ids) {
		dao.delete(ids);
	}

	public Role editDo(Role bean) {
		
		Updater<Role> updater = new Updater<Role>(bean);
		
		Role ret = dao.updateByUpdater(updater);
		return ret;
	}

	@Override
	public Page findPage(Page p,String searchText) {
		return dao.findPage(p.getPageNo(), p.getPageSize(),searchText);
	}

	@Override
	public Role get(Long id) {
		return dao.get(id);
	}

}
